package WuHanTrainStation;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

//第二菜单类
public class secondMenu {
    public void chooseOne() throws IOException, ClassNotFoundException {
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        firstMenu firstMenu = new firstMenu();
        Utility utility = new Utility();
        Use use = new Use();
        int judgment = 0;
        do {
            System.out.println("  11.修改密码");
            System.out.println("  12.修改密保问题");
            System.out.println("  13.设置密保问题");
            System.out.println("  14.返回主菜单");
            System.out.println("  15.退出");
            switch (bufferedReader.readLine()) {
                case "11":
                    utility.modifyPassword();
                    use.use();
                    judgment = 1;
                    break;
                case "12":
                    utility.modifyKey();
                    use.use();
                    judgment = 1;
                    break;
                case "13":
                    utility.key();
                    use.use();
                    judgment = 1;
                    break;
                case "14":
                    firstMenu.utility();
                case "15":
                    System.exit(0);
                default:
                    System.out.println("功能号不存在！请正确输入功能号！");
                    judgment = 1;
                    break;
            }
        } while (judgment == 1);
    }

    public void chooseTwo() throws IOException, ClassNotFoundException {
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        firstMenu firstMenu = new firstMenu();
        thirdMenu thirdMenu = new thirdMenu();
        Use use = new Use();
        Functional functional = new Functional();
        Analysis analysis = new Analysis();
        int judgment = 0;
        do {
            System.out.println("  21.查询车辆信息");
            System.out.println("    211.查询车次");
            System.out.println("    212.查询到达时间");
            System.out.println("    213.查询出发时间");
            System.out.println("    214.查询车辆种类");
            System.out.println("    215.查询场");
            System.out.println("    216.查询车站");
            System.out.println("  22.分析车辆信息");
            System.out.println("    221.分析车次");
            System.out.println("    222.分析到达时间");
            System.out.println("    223.分析出发时间");
            System.out.println("    224.分析车辆种类");
            System.out.println("    225.分析场");
            System.out.println("    226.分析车站");
            System.out.println("  23.返回主菜单");
            System.out.println("  24.退出");
            switch (bufferedReader.readLine()) {
                case "21":
                    thirdMenu.chooseTwoOne();
                case "211":
                    functional.queryTrains();
                    use.use();
                    judgment = 1;
                    break;
                case "212":
                    functional.queryArrivingTime();
                    use.use();
                    judgment = 1;
                    break;
                case "213":
                    functional.queryDepartureTime();
                    use.use();
                    judgment = 1;
                    break;
                case "214":
                    functional.queryType();
                    use.use();
                    judgment = 1;
                    break;
                case "215":
                    functional.queryField();
                    use.use();
                    judgment = 1;
                    break;
                case "216":
                    functional.queryStation();
                    use.use();
                    judgment = 1;
                    break;
                case "22":
                    thirdMenu.chooseTwoTwo();
                case "221":
                    analysis.analysisTrains();
                    use.use();
                    judgment = 1;
                    break;
                case "222":
                    analysis.analysisArrivingTime();
                    use.use();
                    judgment = 1;
                    break;
                case "223":
                    analysis.analysisDepartureTime();
                    use.use();
                    judgment = 1;
                    break;
                case "224":
                    analysis.analysisType();
                    use.use();
                    judgment = 1;
                    break;
                case "225":
                    analysis.analysisField();
                    use.use();
                    judgment = 1;
                    break;
                case "226":
                    analysis.analysisStation();
                    use.use();
                    judgment = 1;
                    break;
                case "23":
                    firstMenu.utility();
                case "24":
                    System.exit(0);
                default:
                    System.out.println("功能号不存在！请正确输入功能号！");
                    judgment = 1;
                    break;
            }
        } while (judgment == 1);
    }
}
